#include<iostream>
using namespace std;
int main() {
    int a, n=0;
    int b[1000] = { 0 };
    cin >> a;
    while (a != 1) {
        b[n] = a;
        n++;
        if (a % 2 == 0) { a /= 2; }
        else { a = a * 3 + 1; }
    }
    b[n] = 1;
    int j = n;
    for (j; j >= 0; j--)
    {
        cout<<" " << b[j];
    }



}


